<?php
// 检查用户人脸数据
try {
    $host = '113.44.136.17';
    $port = '3306';
    $database = 'qiandao';
    $username = 'qiandao';
    $password = 'NGbks3HWx5PhSxDX';
    $charset = 'utf8mb4';

    $dsn = "mysql:host={$host};port={$port};dbname={$database};charset={$charset}";
    $pdo = new PDO($dsn, $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    echo "=== 检查用户人脸数据 ===\n";
    $stmt = $pdo->query("SELECT id, name, card_no, LENGTH(face_data) as face_data_size FROM checkin_member WHERE status = 1");
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo "ID: {$row['id']}, 姓名: {$row['name']}, 卡号: {$row['card_no']}, 人脸数据大小: {$row['face_data_size']} bytes\n";
    }
    
    echo "\n=== 检查最近的签到记录 ===\n";
    $stmt = $pdo->query("SELECT device_sn, member_id, member_name, card_num, is_success, is_stranger, create_time FROM system_checkin_log ORDER BY create_time DESC LIMIT 5");
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo "设备: {$row['device_sn']}, 会员ID: {$row['member_id']}, 姓名: {$row['member_name']}, 卡号: {$row['card_num']}, 成功: {$row['is_success']}, 陌生人: {$row['is_stranger']}, 时间: {$row['create_time']}\n";
    }
    
} catch (Exception $e) {
    echo "错误: " . $e->getMessage() . "\n";
}
